﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace GenUtil.Util
{
    public class Logger
    {
        public log4net.ILog logger = null;
        string sessionId = "";
        public Logger(Type c)
        {
            logger = log4net.LogManager.GetLogger(c);
            log4net.Config.XmlConfigurator.Configure();
            if (HttpContext.Current.Session != null && HttpContext.Current.Session.SessionID != null)
                sessionId = HttpContext.Current.Session.SessionID;

        }
        public void fatal(String error)
        {
            logger.Fatal("SessionId:" + sessionId + " " + error);
        }
        public void fatal(String error, Exception e)
        {
            logger.Fatal("SessionId:" + sessionId + " " + error, e);
        }

        public void debug(String error)
        {
            logger.Debug("SessionId:" + sessionId + " " + error);
        }

        public void info(String error)
        {
            logger.Info("SessionId:" + sessionId + " " + error);

        }

        public void warn(String error)
        {
            logger.Warn("SessionId:" + sessionId + " " + error);
        }

        public void error(String error)
        {
            logger.Error("SessionId:" + sessionId + " " + error);
        }
    }
}
